<%@ include file="include.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	boolean mini=SystemInfo.isMini(session);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
	<title>fotoDB</title>
	<script type="text/javascript">
	
	function changeMode(form){
		var style=document.getElementById('style');
		var style1=document.getElementById('style1');
		var modeName=document.getElementById('modeName').getAttribute('value');
		if (modeName=='sql'){
			form.setAttribute('action','ModeApp?mode=db4o');
		}else{
			form.setAttribute('action','ModeApp?mode=sql');
		}
		form.submit();
	}
	
	function showStatistic(){
		var statisticFrameDiv=document.getElementById('statisticFrameDiv');
		var statisticFrame=document.getElementById('statisticFrame');
		var bodyFrameDiv=document.getElementById('bodyFrameDiv');
		if (statisticFrameDiv.style.display=='none'){
			var randomnumber=Math.floor(Math.random()*100000);
			statisticFrame.src='xml/totalResult.htm?randow='+randomnumber;
			statisticFrameDiv.style.display='inline';
			bodyFrameDiv.style.display='none';
		}else{
			statisticFrame.src='#';
			statisticFrameDiv.style.display='none';
			bodyFrameDiv.style.display='inline';
		}
		
	}
	
	function hideStatistic(){
		var statisticFrameDiv=document.getElementById('statisticFrameDiv');
		var statisticFrame=document.getElementById('statisticFrame');
		var bodyFrameDiv=document.getElementById('bodyFrameDiv');
		statisticFrame.src='#';
		statisticFrameDiv.style.display='none';
		bodyFrameDiv.style.display='inline';
	}
	
	
	function changeBody(target){
		hideStatistic();
		document.getElementById('bodyFrame').src=target;
	}
	
	function setMini(checkBox){
		var form=document.getElementById('miniForm');
		form.action='MiniApp?mini='+checkBox.checked;
		form.submit();
	}
	
</script>
</head>



<body style="position:relative;" onload="init()">
	<div id="header">
		<div id="navi">
			<div class="links">
				<a href="index.jsp">Home</a>
			</div>
			<div class="links">
				<c:if test="${sessionScope.usr!=null||true}">
				<a href="#" onclick="changeBody('search.jsp');">Suchen</a>
				</c:if>
			</div>
			<div class="links">
				<c:if test="${sessionScope.usr!=null||true}">
				<a href="#" onclick="changeBody('<%=dbmode%>SearchApp?searchFor=thumbs&in=all');">Gallery</a>
				</c:if>
			</div>
		
			<div class="links">
				<c:if test="${sessionScope.usr!=null||true}">
				<a href="#" onclick="hideStatistic();document.getElementById('bodyFrame').src='<%=dbmode%>SearchApp?searchFor=categories'">Kate/Schlag</a>
				</c:if>
			</div>
			<div class="links">
				<c:if test="${sessionScope.usr!=null||true}">
				<a href="#" onclick="hideStatistic();document.getElementById('bodyFrame').src='<%=dbmode%>SearchApp?searchFor=allCategorieAndKeyword'">Upload</a>
				</c:if>
			</div>
			<div class="links">
				<c:if test="${sessionScope.usr!=null||true}">
				<form action="ModeApp?mode=" method="post">
					<a href="#" onclick="hideStatistic();changeMode(this.parentNode);">DBMode</a>
				</form>
				</c:if>
			</div>
			<div class="links">
				<c:if test="${sessionScope.usr!=null||true}">
					<a href="#" onclick="showStatistic()">Statistic!</a>
				</c:if>
			</div>
		</div>
		<div id="modeName" class="space" value="<%=SystemInfo.getMode(session)%>">
				<font color="yellow"><font size="5"><%=dbmode%>-mode is active!</font></font> 
			</div>
		<c:if test="${sessionScope.usr!=null||true}">
			<div class="space" style="position:absolute;right:50px">
				<div style="display:none">
				<form id="miniForm" method="post" target="hiddenFrame1" action="">
				</form>
				<iframe id="hiddenFrame1" name="hiddenFrame1"></iframe>
				</div>
				<c:if test="${mini}">
					<input id="miniCheck" name="miniCheck" type="checkbox" checked="checked" onchange="setMini(this);" title="Zeigt kein echt Bild,um laden zeit zu sparen" />
				</c:if>
				<c:if test="${!mini}">
					<input id="miniCheck" name="miniCheck" type="checkbox" onchange="setMini(this);" title="Zeigt kein echt Bild,um laden zeit zu sparen" />
				</c:if>
				<label for="miniCheck" title="Zeigt kein echt Bild,um laden zeit zu sparen" >Mini</label>
			</div>
		</c:if>
		<c:if test="${sessionScope.usr!=null&&false}">
		<form action="LogoutApp">
		<div id="logout">
			Willkommen,Benutzer
			<input type="submit" value="Abmelden"/>
		</div>
		</form>
		</c:if>
		<c:if test="${sessionScope.usr==null&&false}">
		<form action="LoginApp">
		<div id="login">
			Name:
			<input type="text" name="name" size="15"/>
			Passwort:
			<input type="password" name="pass" size="15"/>
			<input type="submit" value="Anmelden"/>
		</div>
		</form>
		</c:if>
	</div>
	<c:if test="${sessionScope.usr==null&&false}">
		<p>Login mit benutzer/123</p>
		<img src="images/logo.png"/>
	</c:if>
	<c:if test="${sessionScope.usr!=null||true}">
	<div id="bodyFrameDiv" align="center" style="margin:0px;padding:0px;height:1040px">
		<iframe id="bodyFrame" name="bodyFrame" width="100%" height="1400px" src="about.jsp" frameborder="0" scrolling="no" style="margin:0px;padding:0px"></iframe>
	</div>
	<div id="statisticFrameDiv" align="center" style="margin:0px;padding:0px;height:1040px;width:1022px;display:none;position:absolute;left:0;top:50">
		<iframe id="statisticFrame" name="statisticFrame" width="100%" height="1022px" src="#" style="margin:0px;padding:0px" frameborder="0" scrolling="no"></iframe>
	</div>
	</c:if>
</body>
</html>